package com.sinopec.uhf.uhfhelp;

import android.text.TextUtils;


/**
 * 创建人：吴冬冬<br/>
 * 创建时间：2021/6/7 14:16 <br/>
 */
public class StringUtils {
    public static boolean validationRfidRule(String s) {
        if (TextUtils.isEmpty(s)) {
            return false;
        }
        String replace = s.replace(" ", "");
        String rfid_regex = PreferenceUtil.getString("rfid_regex", "^((1[1-2]11)[A-Z0-9]{8}$|(86)[A-Z0-9]{10}$|(87)[A-Z0-9]{10}$|(F6)[A-Z0-9]{10}$)");
        return replace.matches(rfid_regex);
    }

    public static String getScanCode(String scanCode) {
        //截取前12位，开头为86
        String substring;
        if (scanCode.startsWith("86")) {
            substring = scanCode.substring(0, 17);
        } else {
            substring = scanCode.substring(18);
        }
        return substring;
    }
}
